<?php
/**
 * Created by IntelliJ IDEA.
 * User: wang_
 * Date: 2017/8/31
 * Time: 15:58
 */

require_once(dirname(__FILE__)."/config/include.php");


//echo print_r(get_AllHeaders()) ;


//$url = "http://127.0.0.1/furniture/call.php" ;
//$url = "http://www.jajahome.com/furniture/call.php" ;

$url = "http://test.jajahome.com/furniture/call.php";
//$callArr = get_param_head("integral_exchange" , array("number" => 1 , "discount_id" => 2)) ;
//$callArr = get_param_head("sort_city_list" ) ;
//$callArr = get_param_head("sort_building_list" , array("city" => 330100)) ;
//$callArr = get_param_head("search_building" , array("city" => 330100 , "search_name" => '一号')) ;
//$callArr = get_param_head("get_favourt_building" , array("city" => 330100)) ;
//$callArr = get_param_head("search" , array("query"=>"857" , "type"=>"item")) ;
//$callArr = get_param_head("item" , array("id" => 30)) ;
//$callArr = get_param_head("config_v2") ;
$callArr = get_param_head("home" ) ;

//$callArr = get_param_head("diy_itemlist_v2" , array("type" => 1 , "id"=>91 , "id_type"=>0)) ;
//$callArr = get_param_head("item" , array("id" => 30)) ;
// 测试打印返回参数．
echo call_Interface($url, $callArr) ;


function get_param_head($cmd , $contArray = null)
{
    $arr = array() ;
    $arr['cmd'] = $cmd ;

    $arr['session'] = array() ;
    $arr['session']['sid'] = "451560" ;
    $arr['session']['token'] = "16c314554356afcb65f914da5b21d0173dbf93" ;
    if (is_null($contArray))
        $arr['content'] = array() ;
    else
        $arr['content'] = $contArray ;
    return $arr ;
}

function call_Interface($url , $param_arr)
{
    $rnt_str = request_post($url , json_encode($param_arr)) ;

    $rnt_arr = json_decode( $rnt_str , true ) ;

  $rnt_str_utf8 = json_encode_utf8($rnt_arr) ;

    return $rnt_str_utf8 ;
}

?>


